<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--<script src="6.js"></script>-->
    <link rel="stylesheet" type="text/css" href="xx.css">
</head>
<body>
<div id="box"></div>
    <script>
        var a = window.prompt('请输入一个数字');
        if (a>10){
            /**
             * 1 创建script对象
             * 2 设置 src属性
             * 3 附加到 head标签内部
             */
            var scriptObj = document.createElement('script');
            scriptObj.src = '6.js';
            console.log(document.head.toString());
            document.head.appendChild(scriptObj)

        } else {
            var scriptObj = document.createElement('script');
            scriptObj.src = '6-2.js';
            console.log(document.head.toString());
            document.head.appendChild(scriptObj)
        }

    </script>

</body>
</html>